Conversation
Signed-off-by: F.N. Claessen <felix@seita.nl>
…default should be False Signed-off-by: F.N. Claessen <felix@seita.nl>
…duling/sign # Conflicts: # flexmeasures/api/v3_0/sensors.py
Documentation build overview
Show files changed (11 files in total): 📝 9 modified | ➕ 0 added | ➖ 2 deleted
|
…en PR #1348) Signed-off-by: F.N. Claessen <felix@seita.nl>
* feat: add `--dry-run` option to `flexmeasures add schedule` Signed-off-by: F.N. Claessen <felix@seita.nl> * style: flake8 (ignore instead of refactor, to avoid conflicts with open PR #1348) Signed-off-by: F.N. Claessen <felix@seita.nl> * docs: main changelog entry Signed-off-by: F.N. Claessen <felix@seita.nl> * docs: CLI changelog entry Signed-off-by: F.N. Claessen <felix@seita.nl> * style: add extra linebreak to better distinguish message from sensor output (especially in case of multiple sensors) Signed-off-by: F.N. Claessen <felix@seita.nl> * docs: fix incorrect PR number in changelog entry Signed-off-by: F.N. Claessen <felix@seita.nl> * docs: update patch release month Signed-off-by: F.N. Claessen <felix@seita.nl> --------- Signed-off-by: F.N. Claessen <felix@seita.nl>
|
Okay, so this needs a migration script (as part of the main TODOs), does it not? |
|
A test plan:
|
|
I ran step 1: schedules look good when the HEMS script is run with that PR activated. |
|
I ran step 3: as expected, clients without the The test excluded clients with the
|
|
Thanks for doing this sizable step! Can you indicate what the situation in the V2GLiberty power sensors actually was w.r.t. I got a question about signs from a hoster just this afternoon (he wondered about the sign of solar data in the tutorial). Maybe this PR could also help clear up where we'd expect which one of our two perspectives. We only have some API documentation saying we take the Prosumer/Asset perspective in schedules/ the API. This PR also switches between these two perspectives - and that is why there are two places where it changes the if statements that might apply We don't even have clear names and descriptions yet, I believe this is the state of things (correct me if I'm wrong, the more I think the more I believe I might be):
I'll gladly have a quick session on this so we can give others one clear section in the docs (if I and the host haven't missed it). |
|
(I will gladly write the docs section if needed) |
They did not have it set.
I recommend an extra step: checking the tutorial results against this PR. Maybe we now actually need to set the attribute for a couple (or all) of the sensors.
This should be correct, including the USEF reason, as far as I remember and according to our own docs (from your link). Our new forecast endpoint is not USEF-like, and we used to have separate endpoints for getting and posting Prognoses, as described by USEF, which did follow USEF sign convention, but these have been sunset years ago.
I don't think this can be a quick session, at least not yet. I am still in the process of scoping how much of a breaking change this PR represents, and trying to document that on this PR. Two extra things to be mindful of:
|
|
Then we should discuss the documentation as a last step of this endeavor. |
|
Is it an option for the future that we stop flipping the sign for schedules, to simplify how we treat data? I feel it has more costs than benefits. Maybe for one version or so we can have a setting for hosts to keep it the old way for them. |
I don't see how this would work. The scheduler needs to have some concept of what is up and down when it applies prices, because it is trying to minimize costs. |
Then I don't understand why we do it. I thought it was to conform to USEF. And for the rest we take the grid perspective (consumption negative, production positive). If we let the scheduler take that perspective, as well, why would it not have a concept of what is up and down anymore? |
We don't enforce this perspective. For example, users can create PV power data with positive values indicating production, and they can also create building power data with positive values indicating consumption. We allow this because we want the UI to match what is in the database, and users usually desire both of these datasets to be shown as positive values. It follows that the scheduler needs some extra information to understand what is up and what is down. |
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
|
@Flix6x I believe we are lacking an overview over the tools at our disposal to tell the scheduler "what is up and what is down".
|
|
"If an asset has been configured as a pure producer or pure consumer, the web service will help avoid mistakes by checking the sign of posted power values." (from documentation/api/notation) This sentence can probably go? I couldn't find the word "pure" in the code or elsewhere in the documentation. |
| if result["sensor"].measures_power and result["sensor"].get_attribute( | ||
| "consumption_is_positive", True | ||
| if result["sensor"].measures_power and not result["sensor"].get_attribute( | ||
| "consumption_is_positive", False |
There was a problem hiding this comment.
I can't find an answer to my own question: If we follow the USEF default that consumption is positive, why does this attribute "consumption_is_positive" default to False now ??
There was a problem hiding this comment.
I just read in a comment that we are " setting the attribute purposely incorrectly".
Can we plan a follow-up where these things are actually name and described properly? I am spending a lot of time now trying to make sense of it, but I couldn't even if we used it the correct way around.
Let's have a session where we make this user-friendly.
On a positive note, I ran all tutorials, and all schedules look exactly as they have been documented earlier.
There was a problem hiding this comment.
Setting the default to save consumption as negative values in the db is mentioned in the original issue description, but I agree it is not thoroughly reasoned - instead, I only mentioned the new default would agree with some inline comment, telling us that consumption is negative in the db (which isn't strictly true anymore - even before this PR, and perhaps it would be better to state this is the default for the db, which only comes into play when the consumption_is_positive attribute is not explicitly set).
So why is that the default for the db? I believe that, historically, we started out with a grid perspective for our db, where production is adding energy to the grid (positive), and consumption is taking it away (negative), and we took a USEF perspective only for our API, which flipped the sign convention.
I am not entirely against changing the default for the db, given that FlexMeasures has transitioned into placing behind-the-meter optimization first. However, we would again have to go through various (field) tests to come up with the correct revision/migration that doesn't unexpectedly flip schedules for end users. As an alternative, I could imagine only changing the default for new power sensors, by defaulting the consumption_is_positive attribute for new sensors to True.
I hope this is valuable input for the session you request.
And really glad to hear the tutorials are unaffected, too!
There was a problem hiding this comment.
Thanks, I forgot tot check the issue.
Good to learnore about the history.
But this seems now to be a conceptual hurdle for users. I hope we find a pathway that creates clarity.
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Description
documentation/changelog.rstdocumentation/changelog.rstdocumentation/api/change_log.rstLook & Feel
How to test
Further Improvements
For instance, a CLI script for manual migration, that let's you do something like:
update timed_belief set event_value = -event_value where sensor_id=1 and source_id in (1, 2, 3) and event_start>='2022-12-24T14:00+02:00' and event_start<'2025-10-01T15:00+02:00;Maybe use
sensor.sourcesto find out the sources of the"scheduler"type.consumption_is_positive).Related Items
Closes #1345.